// 创建服务
const express = require('express');
var app = express();

// 跨域
app.all("*",function(req,res,next){
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "x-requested-with,Authorization,token, content-type");
    res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
	res.header("Access-Control-Allow-Credentials", "true");
    res.header("X-Powered-By", ' 3.2.1');
    res.header("Content-Type", "application/json;charset=utf-8");
    next();
})

// 获取前端参数
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));

// api
app.use('/class', require('./api/class'));
app.use('/student', require('./api/student'));

// 服务端口
app.listen(90,()=>{
	console.log("127.0.0.1:90");
});
